// 1.下包并引用路由
import VueRouter from "vue-router";
import Vue from "vue";
import Home from "@/pages/Home"
import Login from "@/pages/Login"
import News from "@/pages/Home/News"
import Music from "@/pages/Home/Music"
import Game from "@/pages/Home/Game"

// 2.引用路由插件
Vue.use(VueRouter);

// 3.创建路由器对象
const router = new VueRouter({
    mode:"history",
    routes:[
        // 每一个对象都是一个路由规则
        {
            path:"/Home",
            component:Home,
            name:"Home",
            children:[
            {
                path:"News",
                component:News,
                name:"News",
             },
             {
                path:"Music",
                component:Music,
                name:"Music",
             },
             {
                path:"Game",
                component:Game,
                name:"Game",
             },
            ]
        },
        {
            path:"/Login",
            component:Login,
            name:"Login",
        },
    ],
});

// 4.暴露router,注入到Vue实例中
export default router;
